package com.gulimall.product.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MinioConfig {

    @Value("${minio.endpoint}")        // Minio服务器地址
    private String endpoint;

    @Value("${minio.accessKey}")       // 访问密钥
    private String accessKey;

    @Value("${minio.secretKey}")       // 秘密密钥
    private String secretKey;

    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(endpoint)     // Minio服务器地址
                .credentials(accessKey, secretKey) // 认证信息
                .build();
    }
}